Web Development lesson plan
Class: 9th to 12th - Lesson: Web Development - Conditional statements - Temperature checking using HTML and JavaScript

Purpose: To help students understand decision making using conditional statements, reusable functions and basic DOM events and callback functions in JavaScript.

No. of Classes

It will take 3 classes. Students strength 1 or 2 combined with single mail ID.

Material Required
  1. Internet Connection
  2. Google Chrome
  3. Mail ID
  4. Code.org(Website)
  5. Online JavaScript Compiler
Curriculum Content

23. Conditional statements - Temperature checking using HTML and JavaScript

Prior knowledge

Students should know about variables, datatypes, operators and DOM.


Exercise

Exercise:1



  1. Students understand decision making using if- elseif -else statements. Click here to view the flow chart

  2. Exercise:2



  3. Create a webpage where the user enters the temperature. For example when the button is clicked, the program should: Display “It is very hot” if the temperature is greater than 35, display “The weather is pleasant” if the temperature is between 20 and 35 and display “It is cold outside” if the temperature is below 20. Click here to download the solution code

Solutions:1





Teacher Instruction
  1. What changes should you make for your code to handle different temperature units like Fahrenheit?
  2. In this program, you are getting input from the user. Where else do you think input can come from?